<template>
  <div>
    <slot>
      <el-input v-model="initDisplayData" :disabled="true" :readonly="true" class="tl-ref-selector">
        <el-button slot="append" icon="el-icon-search" @click="doUserAssign"></el-button>
      </el-input>
    </slot>
    <tl-ref-user ref="userAssignRef" v-model="selectUserIds" @confirm="doSelectUserIds" :isDisplayDefaultElement="false" :singleSelect="false"> </tl-ref-user>
  </div>
</template>

<script>
/** mixins */
/** 工具类 */
import { getAction, putAction, postAction, deleteAction } from "@tapui/utils/http"
/** 子组件 */
import tlRefUser from "@tapui/components/Tap/Ref/RefUser"
export default {
  components: { tlRefUser },
  data() {
    return {
      url: {
        // queryCodeList: '/base/flowRole/dataCodeList'
        queryUserRoleList: "/base/flowRoleUser/list",
        saveUserRole: "/base/flowRoleUser/batchSave"
      },
      defaultSelectUserIds: "",
      selectUserIds: ""
    }
  },
  props: {
    initDisplayData: {
      default: "",
      type: String
    },
    roleCode: {
      default: "",
      type: String
    },
    roleId: {
      type: Number,
      default: 0
    },
    userId: {
      default: 0,
      type: Number
    }
  },
  methods: {
    /** 得到参照选择的用户*/
    doSelectUserIds(data) {
      // 做提交
      this.$emit("confirm", data)
    },
    /** 角色人员分配*/
    doUserAssign() {
      this.selectUserIds = this.userId + ''
      this.$refs.userAssignRef.openRefDialog()
    }
  }
}
</script>
